<div class="row-fluid">
    <div class="span12">

        <div class="demo-info" style="margin-bottom:10px">
            <div class="demo-tip icon-tip"></div>
            <div>
                Click on a row to select it, click again to deselect it.
                Click the View to view the record.
            </div>
        </div>

        <table id="flex" style="display:none;"></table>

        <button
            id="import_contact_group_btn"
            style="display: none"
            type="button"
            class="multiple-file-upload-manager"
            data-url='<?php echo $this->Html->url(array('controller' => 'Customer', 'action' => 'contact_uploads')); ?>'
            data-save_to="files/user_<?php echo $user_id; ?>"
            data-max-filesize='2000000'
            data-filetypes='/(\.|\/)(csv|xls|xlsx)$/i'
            data-number_upload_files='1'
            data-extra_params_callback='func_extra_param'
            data-callback='func_callback'>
            <i class="fa fa-cloud-upload"></i> Upload
        </button>


        <div id="assign_contact_group_modal" class="modal hide fade">
            <form class="form form-horizontal" method="post" action="" enctype="" style="margin: 0px;">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4>Select Contact Group To Assign</h4>
                </div>
                <div class="modal-body">
                    <div class="control-group">
                        <label class="control-label" for="password"><strong>Contact Group:</strong></label>
                        <div class="controls">
                            <select id="selected_assign_group">
                                <?php foreach($c_group_opt as $value){?>
                                    <option value="<?php echo $value['id']; ?>"><?php echo $value['name']; ?></option>
                                <?php }?>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" id="assign_contact_group_btn" class="btn btn-primary">Assign Contacts To Group</button>
                    <a href="#assign_contact_group_modal" class="btn" data-toggle="modal" id="close-assign_contact_group">Close</a>
                </div>
            </form>
        </div>

    </div>
</div>

<form id="export-contacts-form" method="post" target="ExportContacts" action="<?php echo $this->Html->url(array('controller' => 'Customer', 'action' => 'export_contacts')); ?>">
    <input type="hidden" name="export-group-id" id="export-group-id" value="" />
    <input type="hidden" name="export-contact-ids" id="export-contact-ids" value="" />
</form>

<!-- URLs -->
<input type="hidden" id="table-url" value="<?php echo $this->Html->url(array('controller' => 'Customer', 'action' => 'contacts/get')); ?>" />
<input type="hidden" id="table-editable-url" value="<?php echo $this->Html->url(array('controller' => 'Customer', 'action' => 'contacts/save')); ?>" />
<input type="hidden" id="table-delete-url" value="<?php echo $this->Html->url(array('controller' => 'Customer', 'action' => 'contacts/delete')); ?>" />
<input type="hidden" id="assign-group-url" value="<?php echo $this->Html->url(array('controller' => 'Customer', 'action' => 'contacts/assign')); ?>" />


<?php echo $this->element('multiple_file_upload_manager'); ?>

<!-- Le Script -->
<script type="text/javascript">
    var permissions = <?php echo json_encode($permissions); ?>;
    var c_group_opt = <?php echo json_encode($c_group_opt); ?>;
    var c_group_filter = <?php echo json_encode($c_group_filter); ?>;
</script>
<?php
echo $this->Html->script('scripts/customer/contact.js');
?>
